<?php
/*
  $Id: boxes.php,v 1.33 2003/06/09 22:22:50 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class tableBox {
    var $table_border = '0';
    var $table_width = '';
    var $table_cellspacing = '0';
    var $table_cellpadding = '0';
    var $table_parameters = '';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
        $tableBox_string .= '  <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
              $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr>' . "\n";
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }
  // ------------------ infoBoxHeading ----------
  class infoBoxHeading extends tableBox {
    function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
      $this->table_cellpadding = '0';

      if ($left_corner == true) {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
      } else {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
      }
      if ($right_arrow == true) {
        $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
      } else {
        $right_arrow = '';
      }
      if ($right_corner == true) {
        $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
      } else {
        $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
      }

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => '',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'<br></td>
								<td width="100%"  class="column_left_header_txt">'.$contents[0]['text'].'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'<br></td>
							</tr>
						</table>
						'));

      $this->tableBox($info_box_contents, true);
    }
  } 
  
  // ------------------ infoBox ----------
  class infoBox extends tableBox {
    function infoBox($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $this->tableBox($info_box_contents, true);
    }

    function infoBoxContents($contents) {
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $info_box_contents = array();
      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
                                           'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
                                           'params' => ' class="column_left"',
                                           'text' => '
						<table cellspacing="0" cellpadding="0" border="0" >
							<tr><td bgcolor="#E0E0D6">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
								<td width="100%" class="column_left">
									<br style="line-height:3px">'.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').'</td>
								<td bgcolor="#E0E0D6">'.tep_draw_separator('spacer.gif', '1', '1').'</td></tr>
						</table>
						<table cellspacing="0" cellpadding="0" border="0" >
							<tr><td width="190" height="4">'.tep_image(DIR_WS_IMAGES.'line1.gif').'</td></tr>
							<tr><td width="190" height="3"></td></tr>
						</table>										   
						'));
      }

      return $this->tableBox($info_box_contents);
    }
  }
  // ------------------ infoBox_OKKO (VuNH added) ----------
  class infoBox_OKKO extends tableBox {
    function infoBox_OKKO($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $this->tableBox($info_box_contents, true);
    }

    function infoBoxContents($contents) {
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $info_box_contents = array();
      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
                                           'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
                                           'params' => ' class="column_left"',
                                           'text' => '
						<table cellspacing="0" cellpadding="0" border="0" >
							<tr><td width="100%" class="column_left">
									<br style="line-height:3px">'.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').'</td>
								'.'</tr>
						</table>
						<!-- begin : Vunh remmed
						<table cellspacing="0" cellpadding="0" border="0" >
							<tr><td width="190" height="3"></td></tr>
						</table>				
						end : Vunh remmed -->
						'));
      }

      return $this->tableBox($info_box_contents);
    }
  }
  // ------------------ infoBoxHeading1 ----------
  class infoBoxHeading1 extends tableBox {
    function infoBoxHeading1($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
      $this->table_cellpadding = '0';

      if ($left_corner == true) {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
      } else {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
      }
      if ($right_arrow == true) {
        $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
      } else {
        $right_arrow = '';
      }
      if ($right_corner == true) {
        $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
      } else {
        $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
      }

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => '',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q3.gif').'<br></td>
								<td width="100%"  class="column_left_header_txt1">'.$contents[0]['text'].'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q4.gif').'<br></td>
							</tr>
						</table>
						'));

      $this->tableBox($info_box_contents, true);
    }
  } 
  
  // ------------------ infoBox1 ----------
  class infoBox1 extends tableBox {
    function infoBox1($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $this->tableBox($info_box_contents, true);
    }

    function infoBoxContents($contents) {
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $info_box_contents = array();
      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
                                           'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
                                           'params' => '',
                                           'text' => '
						<table cellspacing="0" cellpadding="0" border="0" bgcolor="#F0F0F0" class="product column_left_bord_bott">
							<tr>
								<td>'.tep_draw_separator('spacer.gif', '20', '1').'</td>
								<td width="100%">'.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').'</td>
								<td>'.tep_draw_separator('spacer.gif', '17', '1').'</td>
							</tr>
						</table>										   
						'));
      }

      return $this->tableBox($info_box_contents);
    }
  }
  // ------------------ infoBox2 ----------
  class infoBox2 extends tableBox {
    function infoBox2($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $this->tableBox($info_box_contents, true);
    }

    function infoBoxContents($contents) {
      $this->table_cellpadding = '0';
      $this->table_parameters = 'class=""';
      $info_box_contents = array();
      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
                                           'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
                                           'params' => ' width="100%"',
                                           'text' => ''.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').''));
      }

      return $this->tableBox($info_box_contents);
    }
  }
  //----------------------------------------------- tableBox_output ----------------------------------
 class tableBox_output {
    var $table_border = '0';
    var $table_width = '';
    var $table_cellspacing = '0';
    var $table_cellpadding = '0';
    var $table_parameters = ' ';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox_output($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= '' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
        
		 
		 if ($i != 0) { $tableBox_string .= '
		
					<tr><td height="10" colspan="9" style="background:url(images/line_bg.gif) left top repeat-x;">'.tep_draw_separator('spacer.gif', '1', '1').'</td></tr>			 
					 ';} 
					  
		$tableBox_string .= '   <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
			
                if ($x >= 1) { $tableBox_string .= '
											<td>'.tep_draw_separator('spacer.gif', '12', '1').'</td>
											<td class="bg6" style="width:1px;">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
											<td>'.tep_draw_separator('spacer.gif', '16', '1').'</td>				
											';} 
				 
			  $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>  ' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr> 	' . "\n";
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }
   //----------------------------------------------- tableBox_output_OKKO (Vunh added) ----------------------------------
 class tableBox_output_OKKO {
    var $table_border = '0';
    var $table_width = '';
    var $table_cellspacing = '0';
    var $table_cellpadding = '0';
    var $table_parameters = ' ';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox_output_OKKO($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= '' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
        
		 
		
		$tableBox_string .= '   <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
			
                if ($x >= 1) { $tableBox_string .= '
											<td>'.tep_draw_separator('spacer.gif', '12', '1').'</td>
											<td class="bg6" style="width:1px;">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
											<td>'.tep_draw_separator('spacer.gif', '16', '1').'</td>				
											';} 
				 
			  $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>  ' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr> 	' . "\n";
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }
  //----------------------------------------------- tableBox_output_OKKO_top_view (Vunh added) ----------------------------------
 class tableBox_output_OKKO_top_view {
    var $table_border = '0';
    var $table_width = '';
    var $table_cellspacing = '0';
    var $table_cellpadding = '0';
    var $table_parameters = ' ';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox_output_OKKO_top_view($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= '' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
        
		 
		
		$tableBox_string .= '   <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
			
                if ($x >= 1) { $tableBox_string .= '
											<td>'.tep_draw_separator('spacer.gif', '12', '1').'</td>
											<td>'.tep_draw_separator('spacer.gif', '16', '1').'</td>							
											';} 
				 
			  $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>  ' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr> 	' . "\n";
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }
//---------------- tableBox_output --------------------- 
  class contentBox extends tableBox_output {
    function contentBox($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = ' class="box_width_cont product"';
      $this->tableBox_output($info_box_contents, true);
    }

    function contentBoxContents($contents) {
      $this->table_cellpadding = '';
      $this->table_parameters = 'class=""';
      return $this->tableBox_output($contents);
    }
  }
//---------------- contentBox_OKKO (Vunh added) --------------------- 
  class contentBox_OKKO extends tableBox_output_OKKO {
    function contentBox_OKKO($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = ' class="box_width_cont product"';
      $this->tableBox_output_OKKO($info_box_contents, true);
    }

    function contentBoxContents($contents) {
      $this->table_cellpadding = '';
      $this->table_parameters = 'class=""';
      return $this->tableBox_output_OKKO($contents);
    }
  }
//---------------- contentBox_OKKO (Vunh added) --------------------- 
  class contentBox_OKKO_top_view extends tableBox_output_OKKO_top_view {
    function contentBox_OKKO_top_view($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
      $this->table_cellpadding = '0';
      $this->table_parameters = ' class="box_width_cont product"';
      $this->tableBox_output_OKKO_top_view($info_box_contents, true);
    }

    function contentBoxContents($contents) {
      $this->table_cellpadding = '';
      $this->table_parameters = 'class=""';
      return $this->tableBox_output_OKKO_top_view($contents);
    }
  }
// ------------------ contentBoxHeading ---------------------------------------------------------
  class contentBoxHeading extends tableBox {
    function contentBoxHeading($contents) {
      $this->table_width = '';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array( array('params' => '',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
								<td class="column_left_header_txt">'.$contents[0]['text'].'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
							</tr>	
						</table>										 
					'));

      $this->tableBox($info_box_contents, true);
    }
  }

//---------------- contentBoxHeading_WHATS_NEW --------------------- 
  class contentBoxHeading_WHATS_NEW extends tableBox {
    function contentBoxHeading_WHATS_NEW($contents) {
      $this->table_width = '100%';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => '',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
								<td class="column_left_header_txt">'.BOX_HEADING_WHATS_NEW.'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
							</tr>	
						</table>						
						'));

      $this->tableBox($info_box_contents, true);
    }
  }
//---------------- contentBoxHeading_ProdNew --------------------- 
  class contentBoxHeading_ProdNew extends tableBox {
    function contentBoxHeading_ProdNew($contents) {
      $this->table_width = '100%';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => ' class=""',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
								<td class="column_left_header_txt">'.HEADING_TITLE.'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
							</tr>	
						</table>						
						'));

      $this->tableBox($info_box_contents, true);
    }
  }

  //---------------- vunh : added contentBoxHeading_ProdTopView --------------------- 
  class contentBoxHeading_ProdTopView extends tableBox {
    function contentBoxHeading_ProdTopView($contents) {
      $this->table_width = '100%';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => ' class=""',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
								<td class="column_left_header_txt">'.HEADING_TITLE_TOP_VIEW.'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
							</tr>	
						</table>						
						'));

      $this->tableBox($info_box_contents, true);
    }
  }

  //---------------- vunh : added contentBoxHeading_ProdHotView --------------------- 
  class contentBoxHeading_ProdHotView extends tableBox {
    function contentBoxHeading_ProdHotView($contents) {
      $this->table_width = '100%';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => ' class=""',
                                         'text' => '
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q1.gif').'</td>
								<td class="column_left_header_txt">'.HEADING_TITLE_HOT_VIEW.'</td>
								<td>'.tep_image(DIR_WS_IMAGES.'q2.gif').'</td>
							</tr>	
						</table>						
						'));

      $this->tableBox($info_box_contents, true);
    }
  }

  class errorBox extends tableBox {
    function errorBox($contents) {
      $this->table_data_parameters = 'class="errorBox"';
      $this->tableBox($contents, true);
    }
  }


//---------------- tableBox_shopping_cart --------------------- 
class tableBox_shopping_cart {
    var $table_border = '0';
    var $table_width = '';
    var $table_cellspacing = '0';
    var $table_cellpadding = '0';
    var $table_parameters = '';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox_shopping_cart($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
       if ($i >= 1) { $tableBox_string .= '
	   
							  <tr><td colspan="7" class="bg16"></td></tr>
							  
							  ';}
	   
	    $tableBox_string .= ' <tr';
		
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
              if ($x >= 1) $tableBox_string .= '
			  
			  						<td width="1" class="bg6">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
										
			  ';
			  
 			  $tableBox_string .= '     <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
			  
			    if ($i == 0)  $tableBox_string .= tep_draw_prod_top();
				else $tableBox_string .= tep_draw_prod_top();
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
			  if ($i == 0)  $tableBox_string .= tep_draw_prod_bottom();
			  else $tableBox_string .= tep_draw_prod_bottom();
			  
              $tableBox_string .= '</td>' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>'.tep_draw_prod_top_1() . $contents[$i]['text'] . tep_draw_prod_bottom_1().'</td>' . "\n";
        }

        $tableBox_string .= '  </tr>' . "\n";
		
/*  if ($i >= 2) {  */
 $tableBox_string .= '
										 
 ';
 /*  }  */		
		
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }
  class productListingBox extends tableBox_shopping_cart {
    function productListingBox($contents) {
      $this->table_parameters = ' class="box_width_cont product"';
      $this->tableBox_shopping_cart($contents, true);
    }
  }
  
// -------------------------------------- --------------------------  
  function tep_draw_heading_top()
  {
 			/*  require(DIR_WS_BOXES . 'panel_top.php');  */ 
  echo '';
  }
// -------------------------------------- --------------------------  
function tep_draw_heading_bottom()
{

echo '
';
}
// -------------------------------------- --------------------------
// -------------------------------------- --------------------------  
  function tep_draw_heading_top_1()
  {
  echo '
  						<table cellpadding="0" cellspacing="0" border="0" style="border-left:1px solid #E0E0D6;border-right:1px solid #E0E0D6;">
							<tr><td style="border-left:13px solid #ffffff;border-right:13px solid #ffffff;border-bottom:7px solid #ffffff;">
  ';
 			
  }
// -------------------------------------- --------------------------  
function tep_draw_heading_bottom_1()
{

echo ' 
								
							</td></tr>
						</table>
						<table cellspacing="0" cellpadding="0" border="0" >
							<tr>
								<td>'.tep_image(DIR_WS_IMAGES.'q6.gif').'</td>
								<td width="100%" class="bg5"></td>
								<td>'.tep_image(DIR_WS_IMAGES.'q5.gif').'</td>
							</tr>
							<tr><td height="6" colspan="3"></td></tr>							
						</table>
';
}
// -------------------------------------- --------------------------
// -------------------------------------- --------------------------   
  function tep_draw_heading_top_2()
  {
 			/*  require(DIR_WS_BOXES . 'panel_top.php');  */ 
  echo '';
  }
// -------------------------------------- --------------------------  
function tep_draw_heading_bottom_2()
{

echo '';
} 
// -------------------------------------- --------------------------
  function  tep_draw_prod_top()
  {
  return $table = ' ';
  }
// -------------------------------------- --------------------------
  function  tep_draw_prod_bottom()
  {
   return $table =  '';
  }
// -------------------------------------- --------------------------  
  function tep_draw_result_top()
  {
  echo '';
  }
// -------------------------------------- --------------------------  
function tep_draw_result_bottom()
	{
	echo '';
	}
// -------------------------------------- --------------------------  

  	// ------------------ infoBox_77 ----------
	class infoBox_77 extends tableBox {
	function infoBox_77($contents) {
	  $info_box_contents = array();
	  $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
	  $this->table_cellpadding = '0';
	  $this->table_parameters = 'class=""';
	  $this->tableBox($info_box_contents, true);
	}
	
	function infoBoxContents($contents) {
	  $this->table_cellpadding = '0';
	  $this->table_parameters = ' class="product"';
	  $info_box_contents = array();
	  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
		$info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
										   'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
										   'params' => '',
										   'text' => ''.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').''));
	  }
	
	  return $this->tableBox($info_box_contents);
	}
	}
	// ------------------ infoBox_78 ----------
	class infoBox_78 extends tableBox {
	function infoBox_78($contents) {
	  $info_box_contents = array();
	  $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
	  $this->table_cellpadding = '0';
	  $this->table_cellspacing = '1';
	  $this->table_parameters = 'class="infoBox"';
	  $this->tableBox($info_box_contents, true);
	}
	
	function infoBoxContents($contents) {
	  $this->table_cellpadding = '0';
	   $this->table_cellspacing = '15';
	  $this->table_parameters = 'class="infoBoxContents "';
	  $info_box_contents = array();
	  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
		$info_box_contents[] = array(  array (  'align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
										   'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
										   'params' => ' class="main"',
										   'text' => ''.(isset($contents[$i]['text']) ? $contents[$i]['text'] : '').''));
	  }
	
	  return $this->tableBox($info_box_contents);
	}
	}
?>
